home *** CD-ROM | disk | FTP | other *** search
- Path: news.nynexst.com!news
- From: Leonid Ilyevsky <leonid@nynexst.com>
- Newsgroups: comp.lang.c++
- Subject: Threads and pipes
- Date: Fri, 09 Feb 1996 10:33:21 -0500
- Organization: NYNEX S&T
- Message-ID: <311B6941.E40@nynexst.com>
- NNTP-Posting-Host: orange.nynexst.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (X11; I; SunOS 5.4 sun4m)
-
- Help ! I need threads in my program to talk to each other through the
- pipe. I don't want to use regular Unix pipes (I tested this approach,
- it works fine) because that would involve an overhead of system calls.
- However, I want all the functionality of the pipe, that is:
-
- 1. Ability to use iostream methods.
- 2. The writing thread should be able to:
- (a) write any information to the pipe like to any stream (see #1)
- (b) close the pipe after it's done
- 3. The reading thread should be able to:
- (a) read from the pipe like from any stream (see again #1)
- (b) be blocked if there is nothing to read at the moment, but the
- pipe's writing end is not closed yet
- (c) be waked up when something new was written to the pipe
- (d) get EOF if pipe's writing end is closed and everything is read
-
- I tried strstream object, but it has only some of these features.
- It has #1 (#2a + #3a), but there is no such thing as #2b. The #3b is
- not there, it gets EOF when everything is read, and the writing thread
- is completely confused after that, so don't even ask about #3c.
- I learned from the manual that this problem can be solved by overriding
- some virtual functions in streambuf base class. But I wonder if there
- is something ready to use.
- Please, reply by E-mail.
- --
-
- Leonid Ilyevsky NYNEX Science and Technology
- E-mail: leonid@nynexst.com 500 Westchester Ave.
- Phone:(914)644-2086 Fax:(914)644-2301 White Plains, NY 10604
-